<template>
  <div id="app">
    <Header  v-if="this.static==null"/>
    <keep-alive>
      <router-view></router-view>
    </keep-alive>
    <Footer v-if="this.static==null"/>
  </div>
</template>

<script>
  import Header from "./components/Header.vue";
  import Footer from "./components/Footer.vue";

  export default {
    name: "App",
    components: {
      Header,
      Footer,
    },
    data() {
      return {
        static:null
      }
    },
    mounted() {
      if (this._isMobile())
        this.$router.replace("/mobile");
    },
    methods: {
      _isMobile() {
        let flag = navigator.userAgent.match(
            /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
        );
        this.static = flag;
        console.info(flag, 'aaaa',this.static)
        return flag;
      },
    },
  };
</script>

<style>
  #app {
    font-family: "MicroSoft YaHei", Avenir, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-align: center;
  }
</style>
